
import java.util.ArrayList;
import java.util.HashMap;


public class SelectIndex 
{
	
	public HashMap<Integer, String> IntersectedList(String[] headerTypes, String path)
	{
		IndexPresent indexes = new IndexPresent();
		ArrayList<Integer> presentIndexes = new ArrayList<Integer>();
		presentIndexes = indexes.indexPresentList(headerTypes, path);
		HashMap<Integer, String> hashMap = new HashMap<Integer, String>();
		for(int i = 0; i < Selection.select.size(); i++)
		{
			for(int j=0;j< Selection.select.get(i).size();j+=2)
			{
				String op = Selection.select.get(i).get(j);
				
				if(op.equals("0")) //equality condition 
				{
				
					if(presentIndexes.contains(i+1)) //if there is an index on this column
					{
						if(hashMap.containsKey(i+1))
						{
							System.exit(0);
						}
						else
						{
							hashMap.put(i+1, Selection.select.get(i).get(j+1));
							Selection.select.get(i).remove(j);
							Selection.select.get(i).remove(j);
							j=j-2;
						}	
					}
				}
			}
		}

		return hashMap;
	}
}